package org.acceleo.modules.uml2.services;


import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Stereotype;

import fr.obeo.acceleo.gen.template.eval.ENodeCastException;

public class Uml2Services {

	/**
	 * Verify if an Element have a stereotype.
	 * Use keyword and profil to find stereotype. 
	 * Multiple stereotype are allow.
	 * @param elt Element used.
	 * @param stereotype Stereotype to search.
	 * @return true if found. false else.
	 * @throws ENodeCastException
	 */
	public boolean hasStereotype(Element elt, String stereotype) throws ENodeCastException {
		// search with real stereotype
		Stereotype stereotypeFound = elt.getApplicableStereotype(stereotype);
		if (stereotypeFound == null) {
			
			// search with keywords
			if (elt.hasKeyword(stereotype))
					return true;
			
			return false;
		}
		else
			return true;		
	}	

}
